#include<sys/socket.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/time.h>
#include<netdb.h>
#include<pthread.h>
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<arpa/inet.h>

#define PORT 3000
struct login_info
{
	 char name[128];
	 char password[128];
 };

int main(int argc,char **argv)
{

    pthread_t login,sendMessage,recvMessage;
    if(argc!=2){
	
	  perror("Usage: ./server IP_Address");
	 
	
	}
    printf("please input your user name:\n");
    gets(login_input.name);
    printf("please input your password\n");
    gets(login_input.password);

    int socket_descriptor;
    struct sockaddr_in remoteServer;
    struct login_info login_input;


   socket_descriptor=socket(AF_INET,SOCK_STREAM,0);
   remoteServer.sin_family = AF_INET;
   remoteServer.sin_port=htons(PORT);
   remoteServer.sin_addr.s_addr=inet_addr(argv[1]);

   if(connect(socket_descriptor,(struct sockaddr *)&remoteServer,sizeof(remoteServer))==-1){
   
    perror("connect error");

   }

   

	 if(send(socket_descriptor,&login_input,sizeof(login_input),0)==-1){
	 
	   printf("Login error");
	 
	 }

	 while(1){
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 }
   
}

